package com.example.app.components


import androidx.compose.material.Switch
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.runtime.remember as remember1

@Composable
fun SwitchSample() {
    // 导3次包
    var check by remember1{
        mutableStateOf(false)
    }
    // checked 当前选中状态
    // onCheckedChange 状态变更时执行的回调
    Switch(checked = check, onCheckedChange = {
        check = !check
    })
}

@Preview(
    showSystemUi = true
)
@Composable
fun SwitchSamplePreview() {
    SwitchSample()
}

